home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / glimpse-2.1 / libtemplate / include / ccache_list.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-16  |  3.9 KB  |  96 lines

  1. /*
  2.  *   ccache_list.h -- definitions for CS 2270 linked list package
  3.  *   
  4.  *   Mark Peterson  9/91
  5.  *
  6.  *  $Id: ccache_list.h,v 1.6 1995/01/10 16:30:21 hardy Exp $
  7.  *
  8.  *  ----------------------------------------------------------------------
  9.  *  Copyright (c) 1994, 1995.  All rights reserved.
  10.  *  
  11.  *          Mic Bowman of Transarc Corporation.
  12.  *          Peter Danzig of the University of Southern California.
  13.  *          Darren R. Hardy of the University of Colorado at Boulder.
  14.  *          Udi Manber of the University of Arizona.
  15.  *          Michael F. Schwartz of the University of Colorado at Boulder. 
  16.  *  
  17.  *  This copyright notice applies to all code in Harvest other than
  18.  *  subsystems developed elsewhere, which contain other copyright notices
  19.  *  in their source text.
  20.  *  
  21.  *  The Harvest software was developed by the Internet Research Task
  22.  *  Force Research Group on Resource Discovery (IRTF-RD).  The Harvest
  23.  *  software may be used for academic, research, government, and internal
  24.  *  business purposes without charge.  If you wish to sell or distribute
  25.  *  the Harvest software to commercial clients or partners, you must
  26.  *  license the software.  See
  27.  *  http://harvest.cs.colorado.edu/harvest/copyright,licensing.html#licensing.
  28.  *  
  29.  *  The Harvest software is provided ``as is'', without express or
  30.  *  implied warranty, and with no support nor obligation to assist in its
  31.  *  use, correction, modification or enhancement.  We assume no liability
  32.  *  with respect to the infringement of copyrights, trade secrets, or any
  33.  *  patents, and are not responsible for consequential damages.  Proper
  34.  *  use of the Harvest software is entirely the responsibility of the user.
  35.  *  
  36.  *  For those who are using Harvest for non-commercial purposes, you may
  37.  *  make derivative works, subject to the following constraints:
  38.  *  
  39.  *  - You must include the above copyright notice and these accompanying 
  40.  *    paragraphs in all forms of derivative works, and any documentation 
  41.  *    and other materials related to such distribution and use acknowledge 
  42.  *    that the software was developed at the above institutions.
  43.  *  
  44.  *  - You must notify IRTF-RD regarding your distribution of the 
  45.  *    derivative work.
  46.  *  
  47.  *  - You must clearly notify users that your are distributing a modified 
  48.  *    version and not the original Harvest software.
  49.  *  
  50.  *  - Any derivative product is also subject to the restrictions of the 
  51.  *    copyright, including distribution and use limitations.
  52.  *  
  53.  */
  54. #ifndef _CCACHE_LIST_H_
  55. #define _CCACHE_LIST_H_
  56.  
  57. typedef struct list_node {    /*list node type */
  58.     struct list_node *next;    /*points to the following node */
  59.     struct list_node *previous;    /*points to the previous node */
  60.     Datum *data;        /*stores data record in list */
  61. } List_Node;
  62.  
  63.  
  64. typedef struct {        /*list header node */
  65.     List_Node *first;    /*points to the first node */
  66.     List_Node *last;    /*points to the last node */
  67.     unsigned int count;
  68.     /*keeps count of the number of nodes in list */
  69.     int (*compare) ();    /*A compare function */
  70. } Linked_List;
  71.  
  72.  
  73. /*
  74.    **The list toolkit functions:
  75.  */
  76.  
  77. Linked_List *list_create();    /*initialize list header block */
  78. void list_destroy();        /*destroy list header block */
  79. List_Node *list_insert();    /*insert a new node in the list */
  80. Datum *list_delete();        /*delete a node from the list */
  81. List_Node *list_find();        /*find a node in the list */
  82. Boolean list_apply();        /*apply a function to each node in the list */
  83.  
  84. /*Built in Macros */
  85. #define list_first(head) ((head)->first)    /*find the first node in the list */
  86. #define list_next(node) ((node)->next)    /*find the next node in the list */
  87. #define list_last(head) ((head)->last)    /*find the last node in the list */
  88. #define list_previous(node) ((node)->previous)
  89. /*find the previous node in the list */
  90.  
  91. #define list_getdata(node) ((node)->data)    /*get the data from the list */
  92. void list_putdata();        /*modify the data in the node in the list */
  93. #define list_length(head) ((head)->count)    /*find the length of the list */
  94.  
  95. #endif
  96.